#!/usr/bin/env python
# coding=utf-8
import redis
import json
import sys
import config
locked_key = "get_task_status"
def RedisConn():
    redis_host = '10.0.0.31'
    redis_port = 6379
    redis_db = 0
    #print config.Redis_config
    r1 = redis.StrictRedis(host=config.Redis_config['Host'], port=config.Redis_config['Port'], db=0, password=config.Redis_config['Passwd'], socket_timeout=None, connection_pool=None, charset='utf-8', errors='strict', unix_socket_path=None)
    #r1 = redis.Redis(host= redis_host,port = redis_port,db = redis_db)
    return r1

r1 = RedisConn()
key = r1.get("playbooktaskid")
data = r1.hget("prepare_run_tasks_map",key)
r1.set(locked_key,"off")
if data:
    #print json.dumps(data)
    print data
